package com.jm.product.entity;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 商品图片Entity
 * @author sunshine
 * @version 2017-07-04
 */
@Entity
@Table(name = "es_goods_photo")
@Cache(region = "com.jm.cache", usage = CacheConcurrencyStrategy.READ_WRITE)
public class GoodsPhoto extends IdEntity<Integer> {

	  /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private String thumbnail;
	private String small;
	private String big;
	private String original;
	private String tiny;
	private int isdefault;
	@ManyToOne
    @JoinColumn(name="goods_id")
	private Goods goods;

	public String getThumbnail() {
		return thumbnail;
	}

	public void setThumbnail(String thumbnail) {
		this.thumbnail = thumbnail;
	}

	public String getSmall() {
		return small;
	}

	public void setSmall(String small) {
		this.small = small;
	}

	public String getBig() {
		return big;
	}

	public void setBig(String big) {
		this.big = big;
	}

	public String getOriginal() {
		return original;
	}

	public void setOriginal(String original) {
		this.original = original;
	}

	public String getTiny() {
		return tiny;
	}

	public void setTiny(String tiny) {
		this.tiny = tiny;
	}

	public int getIsdefault() {
		return isdefault;
	}

	public void setIsdefault(int isdefault) {
		this.isdefault = isdefault;
	}

	public Goods getGoods() {
		return goods;
	}

	public void setGoods(Goods goods) {
		this.goods = goods;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((big == null) ? 0 : big.hashCode());
		result = prime * result + isdefault;
		result = prime * result + ((original == null) ? 0 : original.hashCode());
		result = prime * result + ((small == null) ? 0 : small.hashCode());
		result = prime * result + ((thumbnail == null) ? 0 : thumbnail.hashCode());
		result = prime * result + ((tiny == null) ? 0 : tiny.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		GoodsPhoto other = (GoodsPhoto) obj;
		if (big == null) {
			if (other.big != null)
				return false;
		} else if (!big.equals(other.big))
			return false;
		if (isdefault != other.isdefault)
			return false;
		if (original == null) {
			if (other.original != null)
				return false;
		} else if (!original.equals(other.original))
			return false;
		if (small == null) {
			if (other.small != null)
				return false;
		} else if (!small.equals(other.small))
			return false;
		if (thumbnail == null) {
			if (other.thumbnail != null)
				return false;
		} else if (!thumbnail.equals(other.thumbnail))
			return false;
		if (tiny == null) {
			if (other.tiny != null)
				return false;
		} else if (!tiny.equals(other.tiny))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "GoodsPhoto [thumbnail=" + thumbnail + ", small=" + small + ", big=" + big + ", original=" + original
				+ ", tiny=" + tiny + ", isdefault=" + isdefault + ", goods=" + goods + "]";
	}

}
